#!/bin/sh

PSPSDK=$(psp-config -P)
if [ -z "$PSPSDK" ]; then
    echo
    echo "ERROR: Env variable PSPSDK not set."
    echo
    exit 1
fi

echo
echo "---------------"
echo "Objectdraw installer"
echo "---------------"
echo "Creating directories...."
mkdir -p $PSPSDK/include/objectdraw
mkdir -p $PSPSDK/include/objectdraw/libs

echo "Copying lib...."
cp -f  libobjectdraw.a $PSPSDK/lib/

echo "Copying header files...."
cp -f objectdraw/libs/ArrayList.h $PSPSDK/include/objectdraw/libs/
cp -f objectdraw/libs/libconfig.hh $PSPSDK/include/objectdraw/libs/

cp -f objectdraw/Color.h $PSPSDK/include/objectdraw/
cp -f objectdraw/Drawing.h $PSPSDK/include/objectdraw/
cp -f objectdraw/DrawingCanvas.h $PSPSDK/include/objectdraw/
cp -f objectdraw/FilledRect.h $PSPSDK/include/objectdraw/
cp -f objectdraw/FramedRect.h $PSPSDK/include/objectdraw/
cp -f objectdraw/Functions.h $PSPSDK/include/objectdraw/
cp -f objectdraw/Image.h $PSPSDK/include/objectdraw/
cp -f objectdraw/Line.h $PSPSDK/include/objectdraw/
cp -f objectdraw/Object.h $PSPSDK/include/objectdraw/
cp -f objectdraw/Resizable2DInterface.h $PSPSDK/include/objectdraw/
cp -f objectdraw/Text.h $PSPSDK/include/objectdraw/
cp -f objectdraw/TextBox.h $PSPSDK/include/objectdraw/
cp -f objectdraw/Types.h $PSPSDK/include/objectdraw/

cp -f objectdraw.h $PSPSDK/include/

echo "Done!"
echo